package com.office.automate.dto.convertors;

import javax.servlet.http.HttpServletRequest;

import com.office.automate.model.authenticate.ChangePassword;
import com.office.automate.model.authenticate.UserAuthenticator;

public class UserAuthenticatorConvertor {

	public UserAuthenticator convertAuthenticatorRequest(HttpServletRequest request) {
		UserAuthenticator userAuthenticator = new UserAuthenticator();
		userAuthenticator.setUsername(request.getParameter("username"));
		userAuthenticator.setPassword(request.getParameter("password"));
		return userAuthenticator;
	}

	public ChangePassword convertPasswordChangeRequest(HttpServletRequest request) {
		ChangePassword changePassword = new ChangePassword();
		changePassword.setCurrentPassword(request.getParameter("currentPassword"));
		changePassword.setNewPassword(request.getParameter("newPassword"));
		changePassword.setConfirmNewPassword(request.getParameter("confirmNewPassword"));
		return changePassword;
	}
}